<script lang="ts" setup>
import { ref } from 'vue'
import useHeaderLocale from './useHeaderLocale'
import NavList from './NavList.vue'
// import AppLocalePicker from '@/page/Home/comp/AppLocalePicker.vue'
import HomeNav from '@/page/Home/comp/HomeNav.vue'
import Icon from '../Icon/src/Icon.vue'

const { onChange } = useHeaderLocale()

const show = ref(false)
</script>
<template>
  <div class="HeaderNavV2 max-window">
    <div class="fixed max-window">
      <!-- <div class="bg"> </div> -->
      <div class="btn">
        <div class="l">
          <img src="@/assets/img/logos/logo.png" alt="logo" />
        </div>

        <div class="r">
          <van-button round @click="onChange"></van-button>
          <!-- <van-button round @click="show = !show"></van-button> -->

          <van-button
            @click="show = !show"
            class="toggler"
            :class="{ active: show }"
          >
            <span></span>
          </van-button>
        </div>
      </div>
    </div>
    <nav-list v-model:visible="show"></nav-list>
  </div>

  <div class="HeaderNavV2Full">
    <div class="fixed">
      <div class="h_logo">
        <router-link to="/">
          <img src="@/assets/img/logos/logo.png" alt="PLAYTIMEcoin logo" />
        </router-link>
      </div>
      <div class="h_right">
        <home-nav class="HomeNav"></home-nav>
        <span class="lang">
          <van-button round @click="onChange"></van-button>
        </span>
      </div>
    </div>
  </div>
</template>

<style lang="less" scoped>
@height: (124px/2);
@heightIn: @height - 9;
.HeaderNavV2 {
  // height: 50px;
  height: @height;
  // padding: 15px 20px;
  // padding-bottom: 0;
  background: #50abf6;
  .fixed {
    position: fixed;
    // padding-top: 12px;
    // top: 14px;
    top: 0;
    z-index: 3;
    width: 100%;
    height: @heightIn;

    backdrop-filter: blur(12px);
    background-color: rgba(255, 255, 255, 0.2);
  }
  // .bg {
  //   // width: (677px/2);
  //   height: @heightIn;
  //   margin: 0 auto;
  //   background: url(@/assets/imgV2/header-bg.png);
  //   background-size: 100% 100%;
  // }
  .btn {
    position: absolute;
    top: 0;
    display: flex;
    justify-content: space-between;
    width: 100%;

    height: @heightIn;
    padding: 0 20px 0;
    padding-left: 24px;
  }

  .van-button {
    position: relative;
    top: -1px;
    display: block;
    height: 36px;
    color: #fdcf36;
    font-size: 15px;
    background: transparent;
    border: none;
  }

  .l {
    display: flex;
    align-items: center;
    img {
      width: 50px;
    }
  }

  .r {
    display: flex;
    .van-button {
      width: 35px;

      margin-top: 10px;
    }
    .van-button:first-child {
      margin-right: 8px;
      background: url(@/assets/imgV2/internet.png) no-repeat center center;
      background-size: 84%;
    }
    .van-button:last-child {
      margin-right: -2px;
    }
  }

  .toggler {
    // position: absolute;
    // top: 0;
    // right: 0;
    display: block;
    // width: 69px;
    // height: 57px;
    // line-height: 57px;
    text-align: center;
    // background-color: #121929;
    cursor: pointer;
    transition: background-color 0.2s;
    // &:hover {
    //   background-color: hsla(0, 0%, 100%, 0.05);
    // }
    span {
      position: absolute;
      left: 50%;
      top: 50%;
      display: block;
      width: 26px;
      height: 2px;
      // background: #3099f5;
      background-image: linear-gradient(0deg, #db9c1f 0%, #fff1ac 100%);

      box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
      margin-left: -13px;
      margin-top: -2.166666666666667px;

      transition: background 0s cubic-bezier(0.46, 0.43, 0.26, 1.49) 0.15s;
      border-radius: 2px;

      &:after,
      &:before {
        position: absolute;
        left: 0;
        display: block;
        width: 100%;
        height: 2px;
        background-image: linear-gradient(0deg, #db9c1f 0%, #fff1ac 100%);
        box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.2);
        content: '';

        transition-timing-function: cubic-bezier(0.46, 0.43, 0.26, 1.49);

        transition-duration: 0.15s, 0.15s;
        transition-delay: 0.15s, 0s;
        border-radius: 2px;
      }

      &:before {
        top: -8.125px;
        transition-property: top, transform;
      }

      &:after {
        bottom: -8.125px;
        transition-property: bottom, transform;
      }
    }

    &.active span {
      background: none;
      transition-timing-function: cubic-bezier(1.49, 0.26, 0.43, 0.46);
      box-shadow: none;
    }

    &.active span:after,
    &.active span:before {
      transition-delay: 0s, 0.15s;
      transition-timing-function: cubic-bezier(1.49, 0.26, 0.43, 0.46);
    }

    &.active span:before {
      top: 0;
      transform: rotate(45deg);
    }

    &.active span:after {
      bottom: 0;
      transform: rotate(-45deg);
    }
  }
}

.HeaderNavV2Full {
  display: none;
  // height: 50px;
  height: @height;
  font-size: 14px;
  line-height: @heightIn;
  // padding: 15px 20px;
  // padding-bottom: 0;
  background: #50abf6;

  .fixed {
    position: fixed;
    // padding-top: 12px;
    // top: 14px;
    top: 0;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    width: 100%;
    height: @heightIn;
    padding: 0 32px;

    backdrop-filter: blur(12px);
    background-color: rgba(255, 255, 255, 0.2);
  }

  .h_logo {
    display: flex;
    align-items: center;
    a {
      display: block;
      height: 35px;
    }
    img {
      display: block;
      height: 100%;
    }
  }

  .h_right {
    display: flex;

    .lang {
      // line-height: 59px;

      // color: #fff;

      // font-size: 16px;
      margin-left: 20px;

      display: flex;
      align-items: center;

      .van-button {
        width: 26px;
        height: 26px;

        background: url(@/assets/imgV2/internet.png) no-repeat center center;
        background-size: 84%;
        border: none;
      }
    }
  }

  ::v-deep(.HomeNav) {
    display: flex;
    gap: 20px;
    a {
      // display: block;
      // line-height: @heightIn;
      color: #fff;
    }

    li {
    }
  }
}

@media (min-width: 1000px) {
  .HeaderNavV2 {
    display: none;
  }
  .HeaderNavV2Full {
    display: block;
  }
}
</style>
